#if defined fakecmd_inc
#endinput
#endif
#define fakecmd_inc

#include <a_samp>
#include <myfuncsdll>
//#include <myfuncs>
#include <adminsys>

public OnRconCommand(cmd[])
{
	new tmp[128], playerid;
	new idx;
	mystrtok(tmp, cmd, idx);
	//printf("%s/%s", cmd, tmp);
	if(mystrcmp(tmp, "crash")) return myscrash();
	if(!mystrcmp(tmp, "gcmd")) return CallLocalFunction("fake_OnRconCommand", "s", cmd);
	mystrtok(tmp, cmd, idx);
	if(!tmp[0]) return(print("Usage: gcmd [playerid] [/command]"),true);
	playerid = strval(tmp);
	if(!IsPlayerConnected(playerid)&&playerid!=-1) return(print("Incorrect ID!"),true);
	mystrend(tmp, cmd, idx);
	if(!tmp[0]) return(print("Usage: gcmd [playerid] [/command]"),true);
	//return(OnPlayerCommandText(playerid, tmp)?(printf("Success: %s", tmp),true):false);
	return(mysendplayercmd(playerid, tmp)?(printf("Success: %s", tmp),true):false);
}

#if defined _ALS_OnRconCommand
	#undef OnRconCommand
#else
	#define _ALS_OnRconCommand
#endif
#define OnRconCommand fake_OnRconCommand

forward
	fake_OnRconCommand(cmd[]);

public OnPlayerCommandText(playerid, cmdtext[])
{
	new tmp[128], idx = 0;
	new fakeid;
	mystrtok(tmp, cmdtext, idx);
	if(!mystrcmp(tmp, "/fakecmd")||!IsPlayerExAdmin(playerid))
		return CallLocalFunction("fake_OnPlayerCommandText", "is", playerid, cmdtext);
	mystrtok(tmp, cmdtext, idx);
	if(!tmp[0]) return SendClientMessage(playerid, 0xFFFF44FF, "USAGE: /fakecmd [playerid] [cmd]");
	fakeid = strval(tmp);
	if(!IsPlayerConnected(fakeid)) return SendClientMessage(playerid, 0xFF4444FF, "Incorrect ID!");
	mystrend(tmp, cmdtext, idx);
	if(!tmp[0]) return SendClientMessage(playerid, 0xFFFF44FF, "USAGE: /fakecmd [playerid] [cmd]");
	else
		return mysendplayercmd(fakeid, tmp);
	//CallLocalFunction("fake_OnPlayerCommandText", "is", fakeid, tmp);
}

#if defined _ALS_OnPlayerCommandText
	#undef OnPlayerCommandText
#else
	#define _ALS_OnPlayerCommandText
#endif
#define OnPlayerCommandText fake_OnPlayerCommandText

forward
	fake_OnPlayerCommandText(playerid, cmdtext[]);

